<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/7/24 0024
 * Time: 10:09
 */

namespace app\index\controller;
use app\index\model\User;
use think\Controller;
use app\index\controller\BaseController;

class Login extends Controller
{
    public function index(){
        if(request()->isPost()){
            $user = new User;
            $num = $user -> login(input('post.'));
            if ($num == 1) {
                $this -> error('用户不存在！');
            }
            if ($num == 2) {
                $this -> success('登陆成功！',url('index/index'));
            }
            if ($num == 3) {
                $this -> error('密码错误！');
            }
            return;
        }
        return $this -> fetch('login');

    }


}